<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:c="http://java.sun.com/jsp/jstl/core"

      >

    <body>

        <ui:composition template="./../AdminTemplate.xhtml">

            <ui:define name="queryandcss">
                <link rel="stylesheet" href="../css/screen.css" type="text/css" media="screen" title="default" />
            </ui:define>

            <ui:define name="content">
                <h1>Management Customer</h1>
                <br/>
                <h:form id="form">  
                    <h2> <h:link outcome="insertcustomer" styleClass="button" value="Create Customer" /></h2>
                    <br/>
                    <p:growl id="growl" showDetail="true"/>  

                    <p:dataTable var="customer" value="#{customersBean.listCustomer}" resizableColumns="true" id="basicTable">  

                        <p:column headerText="ID" style="width:200px" id="customerId">  
                            #{customer.customerId}  
                        </p:column>   

                        <p:column id="customerName" filterBy="#{customer.customerName}"   
                                  headerText="Name" footerText="Name"  style="width: 200px"
                                  filterMatchMode="contains">  
                            <h:outputText value="#{customer.customerName}" />  
                        </p:column>  

                        <p:column headerText="Phone" style="width:200px" id="phone">  
                            <h:outputText value="#{customer.phone}" />  
                        </p:column>  

                        <p:column headerText="email" style="width:200px" id="email">  
                            <h:outputText value="#{customer.email}" />  
                        </p:column>  

                        <p:column style="width:300px">  
                            <h:column id="actions" headerClass="headertext">
                                <f:facet name="header">
                                </f:facet>
                                <p:commandButton  value="Edit" immediate="true" action="#{customersBean.findCustomer(customer.customerId)}"  />  
                                <p:commandButton onclick="return confirm('Are you sure you want to delete?')" value="delete" action="#{customersBean.deleteCustomer(customer.customerId)}" />  
                                <p:commandButton  value="Detail payment" immediate="true" action="#{paymentBean.inforPayment(customer.customerId)}"  />  

                            </h:column>
                        </p:column>  

                    </p:dataTable>  

                </h:form>  
            </ui:define>

        </ui:composition>

    </body>
</html>
